package com.qipa;

import com.qipa.netty.MainServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

@SpringBootApplication(scanBasePackages = {"com.qipa"})//spring扫描包的路径
@MapperScan("com.qipa.mapper")  //必须是指定到mapper.java 文件所在的路径,如com.qipa 是扫描不到的
@EnableCaching //开启缓存
@EnableAutoConfiguration(exclude = {
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})
public class PlacePoliceApplication implements CommandLineRunner {

    @Autowired
    MainServer mainServer;

    public static void main(String[] args) throws Exception {
        SpringApplication.run(PlacePoliceApplication.class, args);

    }

    @Override
    public void run(String... args) throws Exception {
        mainServer.start();
    }


    /*@Override
    public void run(String... args) throws Exception {
        new Thread(){
            @Override
            public void run() {
                try {
                    mainServer.start();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
    }*/
}
